<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
  <meta charset="UTF-8">
  <title>后台管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  <link rel="stylesheet" href="/admin/static/css/font.css">
  <link rel="stylesheet" href="/admin/static/css/xadmin.css">
  <script type="text/javascript" src="/admin/static/js/jquery.min.js"></script>
  <script type="text/javascript" src="/admin/static/lib/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="/admin/static/js/xadmin.js"></script>

  <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
  <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
  <div class="x-body">
    <form class="layui-form" action="/admin/member/edit" method="POST" enctype="multipart/form-data">
      <input style="display: none" name="id" value="${member.id}">
      <div class="layui-form-item">
        <label for="L_name" class="layui-form-label">
          <span class="x-red">*</span>姓名
        </label>
        <div class="layui-input-inline">
          <input type="text" id="L_name" name="name" required="" lay-verify="member_name" autocomplete="off"
            value="${member.name}" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label for="L_positional_title" class="layui-form-label">
          <span class="x-red">*</span>职称
        </label>
        <div class="layui-input-inline">
          <input type="text" id="L_positional_title" name="positionalTitle" required="" lay-verify="positional_title"
                 value="${member.positionalTitle}" autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label for="L_duties" class="layui-form-label">
          <span class="x-red">*</span>职务
        </label>
        <div class="layui-input-inline">
          <input type="text" id="L_duties" name="duties" required="" lay-verify="duties" autocomplete="off"
                 value="${member.subMenuId}" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label for="L_education" class="layui-form-label">
          <span class="x-red">*</span>学历
        </label>
        <div class="layui-input-inline">
          <input type="text" id="L_education" name="education" required="" lay-verify="education" autocomplete="off"
                 value="${member.education}" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label for="L_role" class="layui-form-label">
          <span class="x-red">*</span>角色
        </label>
        <div class="layui-input-inline">
          <select type="text" id="L_role" name="subMenuId" required="" lay-verify="role"
                  autocomplete="off">
            <c:forEach items="${subMenuList}" var="item">
              ${member.subMenuId}
              <c:if test="${member.subMenuId == item.id}">
                <option value="${item.id}" selected>${item.title}</option>
              </c:if>
              <c:if test="${member.subMenuId != item.id}">
                <option value="${item.id}">${item.title}</option>
              </c:if>
            </c:forEach>
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <label for="L_email" class="layui-form-label">
          <span class="x-red">*</span>邮箱
        </label>
        <div class="layui-input-inline">
          <input type="text" id="L_email" name="email" required="" lay-verify="email" autocomplete="off"
                 value="${member.email}" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label for="L_phone" class="layui-form-label">
          <span class="x-red">*</span>电话
        </label>
        <div class="layui-input-inline">
          <input type="text" id="L_phone" name="phone" required="" lay-verify="phone" autocomplete="off"
                 value="${member.phone}" class="layui-input">
        </div>
      </div>

      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">个人简介</label>
        <div class="layui-input-block">
          <textarea name="profile" placeholder="请输入内容" class="layui-textarea">${member.profile}</textarea>
        </div>
      </div>
      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">研究方向</label>
        <div class="layui-input-block">
          <textarea name="direction" placeholder="请输入内容" class="layui-textarea">${member.direction}</textarea>
        </div>
      </div>
      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">工作经历</label>
        <div class="layui-input-block">
          <textarea name="experience" placeholder="请输入内容" class="layui-textarea">${experience}</textarea>
        </div>
      </div>
      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">荣誉称号</label>
        <div class="layui-input-block">
          <textarea name="honoraryTitle" placeholder="请输入内容" class="layui-textarea">${honoraryTitle}</textarea>
        </div>
      </div>
      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">科研项目</label>
        <div class="layui-input-block">
          <textarea name="project" placeholder="请输入内容" class="layui-textarea">${project}</textarea>
        </div>
      </div>
      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">成果</label>
        <div class="layui-input-block">
          <textarea name="achievement" placeholder="请输入内容" class="layui-textarea">${achievement}</textarea>
        </div>
      </div>
      <div class="layui-form-item">
        <label for="" class="layui-form-label">
          <span class="x-red">*</span>图片
        </label>
        <button type="button" class="layui-btn" id="file-btn">
          <i class="layui-icon">&#xe67c;</i>选择图片
        </button>
        <input type="file" name="img" id="file-input" style="display: none" accept="image/*">
        <span id="show">${member.image}</span>
      </div>

      <div class="layui-form-item">
        <label for="L_repass" class="layui-form-label">
        </label>
        <button class="layui-btn" lay-filter="modify" lay-submit="">
          修改
        </button>
      </div>
    </form>
  </div>
  <script>
    $('#file-btn').on('click', function () {
      $('#file-input').click();
    });
    $('#file-input').on('change', function () {
      $('#show').text(this.files[0].name)
    });
    layui.use(['form', 'layer'], function () {
      $ = layui.jquery;
      var form = layui.form
        , layer = layui.layer;

      //自定义验证规则
      form.verify({
        member_name: function (value) {
          if (value.length < 1) {
            return '姓名不能为空';
          } else if (value.length > 50) {
            return '姓名不能大于50个字符';
          }
        },
        positional_title: function (value) {
          if (value.length < 1) {
            return '职称不能为空';
          } else if (value.length > 10) {
            return '职称不能大于10个字符';
          }
        },
        role: function (value) {
          if (value.length < 1) {
            return '角色不能为空';
          } else if (value.length > 10) {
            return '角色不能大于10个字符';
          }
        },
        duties: function (value) {
          if (value.length < 1) {
            return '职务不能为空';
          } else if (value.length > 50) {
            return '职务不能大于50个字符';
          }
        },
        education: function (value) {
          if (value.length < 1) {
            return '学历不能为空';
          } else if (value.length > 50) {
            return '学历不能大于50个字符';
          }
        }
      });
    });
  </script>
</body>

</html>